package com.lemon.smartsafety.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.lemon.smartsafety.R;
import com.lemon.smartsafety.utils.CommonUtil;

import butterknife.Bind;
import butterknife.ButterKnife;

/**
 * 项目名称：workspace
 * 类描述：
 * 创建人：Fargo
 * 创建时间：2016/8/11 16:53
 * 修改人：Fargo
 * 修改时间：2016/8/11 16:53
 * 修改备注：
 */
public class ViewFireCompanyNone extends LinearLayout {


    @Bind(R.id.txt_img)
    TextView txtImg;
    @Bind(R.id.txt_title)
    TextView txtTitle;
    @Bind(R.id.txt_content)
    TextView txtContent;
    @Bind(R.id.txt_search)
    TextView txtSearch;


    private View view;

    public ViewFireCompanyNone(Context context) {
        super(context);

        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.view_fire_company_none, this);
        ButterKnife.bind(this, view);


        // TODO Auto-generated constructor stub
    }

    public ViewFireCompanyNone(Context context, AttributeSet attrs) {
        super(context, attrs);
        // TODO Auto-generated constructor stub
        LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        view = inflater.inflate(R.layout.view_fire_company_none, this);
        ButterKnife.bind(this, view);


    }


    public interface CallBackInterface {
        public void callBackFunction(View view);

    }

    //Sky--右边按钮单独点击事件
    public interface AllClick {
        public void click();
    }


    public void setAllClick(final AllClick allClick) {
        if (!CommonUtil.viewIsEmpty(txtSearch)) {
            txtSearch.setOnClickListener(new OnClickListener() {
                @Override
                public void onClick(View v) {
                    allClick.click();
                }
            });
        }
    }


    public void setTitle(String title) {
        if(CommonUtil.strIsEmpty(title)){
            txtTitle.setVisibility(GONE);
            return;
        }
        txtTitle.setText(title);
        txtTitle.setVisibility(VISIBLE);
    }


    public void setContent(String content) {
        if(CommonUtil.strIsEmpty(content)){
            txtContent.setVisibility(GONE);
            return;
        }
        txtContent.setText(content);
        txtContent.setVisibility(VISIBLE);
    }

    public void setSearch(String search) {
        if(CommonUtil.strIsEmpty(search)){
            txtSearch.setVisibility(GONE);
            return;
        }
        txtSearch.setText(search);
        txtSearch.setVisibility(VISIBLE);
    }

    public void setTxt_imgVisible(boolean b) {
        if (b) {
            txtImg.setVisibility(VISIBLE);
        } else {
            txtImg.setVisibility(GONE);
        }
    }







}

